<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>站点设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  
    {include file="public/css"}
    {include file="public/js"}
</head>
<body>

<!-- 后台面包导航 -->
{:get_admin_breadcrumb()}


<blockquote class="layui-elem-quote" style="margin-top:10px;">说明：</blockquote>

<form class="layui-form" action="">
 <input type="hidden" name="groupname" value="{$Request.action}">


<div class="layui-tab layui-tab-brief " lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
    <li class="layui-this">网站配置</li>
    <li>SEO配置</li>
    <li>安全管理</li>
  </ul>

  <div class="layui-tab-content" style="height: 100px;">
    <div class="layui-tab-item layui-show">



              <div class="layui-form-item">
                <label class="layui-form-label">站点名称</label>
                <div class="layui-input-inline">
                  <input type="text" name="data[sitename]" lay-verify="sitename" placeholder="前台显示的站点名称" autocomplete="off" class="layui-input" required  lay-verify="required" value="{if !empty($settings.site.sitename)}{$settings.site.sitename}{/if}">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
              </div>
             <div class="layui-form-item">
              <label class="layui-form-label">站点网址</label>
              <div class="layui-input-inline">
                <input type="text" name="data[siteurl]" lay-verify="siteurl" placeholder="站点网址" autocomplete="off" class="layui-input" value="{$settings.site.siteurl}">
              </div>
              <div class="layui-form-mid layui-word-aux">{:about('请添写完整URL地址,例如http://www.youdomain.com/ 注意以 / 结尾')}</div>
            </div>
             <div class="layui-form-item">
              <label class="layui-form-label">网站LOGO</label>
              <div class="layui-input-inline">
              {:upload_images("上传LOGO","data[logo]",$settings.site.logo)}
          
              </div>
              <div class="layui-form-mid layui-word-aux">{:about('logo尺寸120*60')}</div>
            </div>

              <div class="layui-form-item">
              <label class="layui-form-label">客服QQ </label>
              <div class="layui-input-inline">
                <input type="text" name="data[qq]" lay-verify="qq" placeholder="客服QQ" autocomplete="off" class="layui-input" " value="{$settings.site.qq}">
              </div>
              <div class="layui-form-mid layui-word-aux"></div>
            </div>
             <div class="layui-form-item">
              <label class="layui-form-label">电话 </label>
              <div class="layui-input-inline">
                <input type="telphone" name="data[telphone]" lay-verify="telphone" placeholder="电话" autocomplete="off" class="layui-input" " value="{$settings.site.telphone}">
              </div>
              <div class="layui-form-mid layui-word-aux"></div>
            </div>

              <div class="layui-form-item">
              <label class="layui-form-label">ICP备案</label>
              <div class="layui-input-inline">
                <input type="text" name="data[icp]" lay-verify="icp" placeholder="ICP备案" autocomplete="off" class="layui-input" " value="{$settings.site.icp}">
              </div>
              <div class="layui-form-mid layui-word-aux"></div>
            </div>

        <div class="layui-form-item">
                <label class="layui-form-label"> 统计代码</label>
                   <div class="layui-input-inline">
                  <textarea name="data[count_code]" class="layui-textarea">{$settings.site.count_code|htmlspecialchars_decode}</textarea>
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
              </div>  
               <div class="layui-form-item">
                <label class="layui-form-label"> 网站状态</label>
                <div class="layui-input-block">
                  <input type="radio" name="data[website_status]" value="1"  checked="{if $settings.site.website_status ==1}checked{{/if}" title="开启" checked="">
                  <input type="radio" name="data[website_status]" {if $settings.site.website_status ==0}checked{/if} value="0" title="关闭">
                </div>
              </div> 
               <div class="layui-form-item">
                <label class="layui-form-label"> 网站关闭说明</label>
                <div class="layui-input-inline">
           <textarea name="data[website_close]" class="layui-textarea" placeholder="网站关闭说明">{$settings.site.website_close}</textarea>
                </div>
              </div> 
      </div>
 <!-- 运营配置                -->

                <div class="layui-tab-item">
                   <form class="layui-form" action="?">
                        <input type="hidden" name="groupname" value="site">
   <div class="layui-form-item">
                <label class="layui-form-label">SEO标题</label>
                <div class="layui-input-inline">
                  <input type="seo_title" name="data[seo_title]" lay-verify="seo_title" placeholder="" autocomplete="off" class="layui-input" value="{$settings.site.seo_title}">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label">SEO关键词</label>
                <div class="layui-input-inline">
                  <input type="seo_keywords" name="data[seo_keywords]" lay-verify="seo_keywords" placeholder="" autocomplete="off" class="layui-input" value="{$settings.site.seo_keywords}">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
              </div>
              
               <div class="layui-form-item">
                <label class="layui-form-label">SEO描述</label>
                   <div class="layui-input-inline">
                <textarea name="data[seo_description]"  class="layui-textarea">{$settings.site.seo_description}</textarea>
              </div>
                <div class="layui-form-mid layui-word-aux"></div>
              </div>   


          
</div>


<div class="layui-tab-item">
            <div class="layui-form-item">
                          <label class="layui-form-label" >用户注册禁用关键词</label>
                          <div class="layui-input-inline" style="width:300px" >
                            <textarea name="data[register_keywords_ban]" class="layui-textarea" placeholder="">{$settings.site.register_keywords_ban}</textarea>
                          </div>
                          <div class="layui-form-mid layui-word-aux">{:about('用户注册禁用关键词<br> (用户名之间用 | 隔开)')}</div>
               </div>    

</div>


                 <div class="layui-form-item">
                  <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-normal" id="submit" lay-submit="" lay-submit lay-filter="form" >确 定</button>
                    </div>
</div> 


 </form>


</script>

<script>
layui.use(['form','upload'], function(){
  var form = layui.form;upload = layui.upload;
  

  form.on('submit(form)', function(data){
    // layer.msg(JSON.stringify(data.field));
    var data =data.field;
    $.post("{:url('settings/update')}",data,function(json){
       if(json.code == 0){
           layer.msg(json.msg);
       }else if(json.code == -1){
           layer.msg(json.msg);
       }
    });
    return false;
  });




  //普通图片上传
  var uploadInst = upload.render({
    elem: '#upload_img'
    ,url: '{:url("upload/images")}'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#images').attr('src', result); //图片链接（base64）
       
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code == -1){
           //上传失败
        return layer.msg(res.msg);
      }else if(res.code ==0){
           //上传成功
       $('#logo').attr('value',res.data);
        return layer.msg(res.msg);
      }
   
    },
    field:"images[]"
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }

});


});
</script>

</body>

</html>